package com.pig4cloud.pig.admin.controller;

import com.pig4cloud.pig.common.core.util.R;
import com.pig4cloud.pig.common.security.annotation.Inner;
import com.pig4cloud.plugin.websocket.config.WebSocketMessageSender;
import com.pig4cloud.plugin.websocket.handler.CustomPlanTextMessageHandler;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.socket.WebSocketSession;

import java.util.List;

@RequestMapping("/msg")
@RestController
public class ChatController extends CustomPlanTextMessageHandler {
	@Inner(value = false)
	@GetMapping("/send")
	public R sendMsg() {
		WebSocketMessageSender.send("admin","hello from server");
		return R.ok();
	}

//	@Override
//	public void handle(WebSocketSession session, String message) {
//	}
}